package com.placement.app.util;

import java.util.Enumeration;
import java.util.ResourceBundle;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.placement.app.util.Constants;

public class JobProperties {
	private static final Log LOG = LogFactory.getLog(JobProperties.class);
	private static ResourceBundle props=null;
	public static String getProperty(String propertyName)
	{
		String val = null;
		try
		{
			if ( props == null ){
				LOG.debug("Started loading properties from job.properties ");
				props = ResourceBundle.getBundle("job");
				if (LOG.isDebugEnabled()) {
					
					Enumeration enum1=props.getKeys();
					String key=null;
					while(enum1.hasMoreElements())
					{
						key=(String)enum1.nextElement();
						LOG.debug("KEY = "+key+" VALUE = "+(String)props.getObject(key));
					}
				}
				
			}
			
			//props = ResourceBundle.getBundle("srgt");
			
			val = props.getString(propertyName);
		}
		catch (Exception e)
		{
			LOG.error(Constants.EVENT_TYPE_EXCEPTION + " "
					+ Constants.BUSINESS_PROCESS_NAME , e);

		}
		return val;
	}
}
